﻿using System;
using System.ComponentModel;
using Newtonsoft.Json;

namespace Ecobee.Net
{

	[JsonConverter(typeof(CamelCaseStringEnumConverter))]
	[Flags]
	public enum EquipmentStatusType
	{
		None = 2 ^ 0,
		HeatPump = 2 ^ 1,
		CompCool1 = 2 ^ 2,
		CompCool2 = 2 ^ 3,
		AuxHeat1 = 2 ^ 4,
		AuxHeat2 = 2 ^ 5,
		AuxHeat3 = 2 ^ 6,
		Fan = 2 ^ 7,
		Humidifier = 2 ^ 8,
		Dehumidifier = 2 ^ 9,
		Ventilator = 2 ^ 10,
		Economizer = 2 ^ 11,
		CompHotWater = 2 ^ 12,
		AuxHotWater = 2 ^ 13
	}

	/// <summary>
	/// The Thermostat Summary can also return the current status of the equipment controlled by the 
	/// Thermostat. The equipmentStatus data is returned as a list. This list will list 
	/// all equipment which is currently running. If a specific equipment type is not returned in the 
	/// list then it is not running, or "OFF". To retrieve this data the Selection object 
	/// specified in the request should have the includeEquipmentStatus flag set to true. The 
	/// default is false.
	/// </summary>
	public class ThermostatStatus : ApiObject
	{
		private string _identifier = string.Empty;
		private EquipmentStatusType _equipmentStatus = EquipmentStatusType.None;

		/// <summary>
		/// The thermostat identifier.
		/// </summary>
		[JsonProperty(PropertyName = "identifier", DefaultValueHandling = DefaultValueHandling.Ignore, Order = 1)]
		[DefaultValue("")]
		public string Identifier
		{
			get
			{
				return _identifier;
			}
			set
			{
				_identifier = value;
			}
		}

		/// <summary>
		/// If no equipment is currently running no data is returned. Possible values are: heatPump, compCool1, 
		/// compCool2, auxHeat1, auxHeat2, auxHeat3, fan, humidifier, dehumidifier, ventilator, 
		/// economizer, compHotWater, auxHotWater.
		/// </summary>
		[JsonProperty(PropertyName = "equipmentStatus", DefaultValueHandling = DefaultValueHandling.Ignore, Order = 2)]
		[DefaultValue(EquipmentStatusType.None)]
		public EquipmentStatusType EquipmentStatus
		{
			get
			{
				return _equipmentStatus;
			}
			set
			{
				_equipmentStatus = value;
			}
		}
	}
}
